package com.tom.service.impl;

import com.tom.mapper.FoodCateMapper;
import com.tom.pojo.FoodCate;
import com.tom.service.ICateService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("cateService")
public class CateServiceImpl implements ICateService {
    @Resource
    FoodCateMapper cateMapper;

    @Override
    public List<FoodCate> listCate(Integer restId) {
        return cateMapper.selectByRestaurantId(restId);
    }

    @Override
    public int newCate(FoodCate cate) {
        return cateMapper.insertSelective(cate);
    }

    @Override
    public int updateCate(FoodCate cate) {
        return cateMapper.updateByPrimaryKeySelective(cate);
    }

    @Override
    public int deleteCate(Integer cateId) {
        return cateMapper.deleteByPrimaryKey(cateId);
    }
}
